package com.lzh.blog.admin.config;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lzh.lzhframework.domain.entity.LogEntity;
import com.lzh.lzhframework.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author luzhiheng
 * @date 2023-11-29
 */
@Slf4j
@Component
public class ScheduleConfig {

    @Resource
    private LogService logService;

    /**
     * 删除内网记录
     */
//    @Scheduled(cron = "0/5 * * * * ?")
    public void updateBlogRunningInfo() {
        LambdaQueryWrapper<LogEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(LogEntity::getIpSource, "内网");
        logService.remove(queryWrapper);
    }
}